Bending angle detector and straight line extracting device for use therewith and bending angle detecting position setting device

ABSTRACT

In bending angle detection, a linear projected light image formed on the surface of a workpiece is photographed by a photographing device; the actual inclination angle of a specimen is stored as data in correspondence with the inclination angle and position of the specimen in an image; and the bending angle of the workpiece is obtained by accessing the data, with the inclination angle and position of the linear projected light image in an image produced by photographing. In main straight line extraction, main pixels are obtained from the distribution of the brightness of pixels aligned on specified axes and a main straight line is obtained from a plurality of main pixels. For extracting only a necessary straight line from an image including unnecessary straight lines, the photographing device is so disposed as to photograph a lower bender and a second straight line from the bottom end of the image is extracted. In setting a bending angle detecting position, a potential bending step where the bending angle detection of the workpiece might be performed is calculated from simulation data on the bending state of the workpiece in each bending step.

This is a divisional of application Ser. No. 08/290,877 filed Aug. 31,1994, now U.S. Pat. No. 5,652,805 Jul. 27, 1997, which is a 371 ofPCT/JP94/00773 May 12, 1994.

FIELD OF THE INVENTION

The present invention relates to a bending angle detector for detectinga bending angle when a sheet-like workpiece is bent to a specifiedangle; a straight line extracting device for use with the bending angledetector; and a bending angle detecting position setting device forsetting a detecting position when detecting a bending angle of aworkpiece.

BACKGROUND OF THE INVENTION

There have been conventionally known the following bending angledetectors incorporated in bending machines such as press brakes.

(a) Contact type detectors which detect a bending angle of a workpiece,bringing a probe into contact with an inclined surface of the workpiece(e.g., Japanese Patent Publication Laid-Open No. 1-273618 (1989)).

(b) Non-contact type detectors which include a plurality of distancesensors such as overcurrent sensors, electrostatic capacity sensors oroptical sensors and which detect a bending angle of a workpiece bymeasuring the difference between the distances from the respectivedistance sensors to the workpiece (e.g., Japanese Patent PublicationLaid-Open No. 63-49327 (1988), Japanese Patent Publication Laid-Open No.64-2723 (1989), Japanese Patent Publication Laid-Open No. 1-271013(1989)).

These bending angle detectors however present the following drawbacks.

Firstly, the contact-type detectors cannot be suitably used whendetecting a bending angle of a workpiece with short legs, as thesedetectors require comparatively long legs to ensure a high measuringaccuracy. Further, if the contact-type detectors are used for a longtime, long contact with workpieces causes the probe to be worn anddeformed, resulting in a decreased measuring accuracy.

In the case of the non-contact type detectors, a plurality of distancesensors are employed for measuring and calculating the distance fromeach sensor to a bent workpiece, but a long space cannot be kept betweenone sensor and another so that a satisfactory detecting accuracy cannotbe obtained. Further, the non-contact type detectors employingovercurrent sensors or electrostatic capacity sensors have thedisadvantage that since the outputs of these sensors vary depending onthe material of a workpiece to be measured, so that measuring conditionshave to be changed whenever a different material is used. Thenon-contact type detectors employing optical sensors also have thedisadvantage that light directed to the surface of a workpiece dispersesin some surface conditions, which leads to an increased measuring errorand a decreased measuring accuracy. Another disadvantage of this type isthat the measuring accuracy is dependent on sensors to be used and theresolving power of the image receptor.

One proposal to overcome the foregoing drawbacks is set out in JapanesePatent Publication Laid-Open No. 4-145315 (1992) where a slit light ortwo spot lights are directed onto the surface of a workpiece and a lightimage formed on the surface of the workpiece is photographed by aphotographing means to detect a bending angle through image processing.In this bending angle detector, an optical system is arranged such that,as shown in FIG. 28, the optical axis of incident light upon thephotographing means (i.e., camera) lies within a plane perpendicular tothe irradiated surface of the workpiece W. In this arrangement, thefollowing equations hold:

    tan θ'=d/l                                           (a)

    tan θ=h/l                                            (b)

    tan α=d/h                                            (c)

where α is a beam projecting angle, i.e., the angle at which a slitlight (or two spot lights) is directed onto the surface of the workpieceW; θ' is the angle formed by the slit light in an image plane; θ is abending angle of the workpiece W (hereinafter referred to as "workangle"); and d, h, l respectively represent the lengths shown in FIG.28.

From Equations (a), (b) and (c), the following equation (d) is obtained.##EQU1##

In Equation (d), since the beam projecting angle a is given, the workangle θ can be obtained by arithmetic operation if the angle θ' isdetected by image processing.

As one example of the image processing technique, a device whichlinearizes image using the linear least square method is disclosed inJapanese Patent Publication Laid-Open No. 4-62683 (1992). In thisprocessing device, a straight line component is extracted from a binaryimage. More specifically, the number of pixels constituting a binaryimage is reduced without spoiling the straight line approximationcharacteristics of the binary image, and the straight line component ofthe binary image is extracted based on the number of remaining pixels.

An alternative proposal is disclosed in Japanese Patent Publication No.4-70091 (1992) where a bending angle detector attached to a press brakeis freely movable so that it can be positioned at a desired positionwhen detecting a bending angle of a workpiece.

However, the bending angle detector according to the first proposalsuffers from several disadvantages. Firstly, it has been proved that itis difficult to accurately calculate the work angle θ from Equation (d),since the field of a camera serving as the photographing means is spreadbecause of the angle of view of the lens. That is, the relationshipbetween the work angle θ and the angle θ' formed by the slit light inthe image plane is not so simple as Equation (d) when taking the effectsof the angle of view of the lens into consideration. In order tocalculate the work angle θ more accurately, it is necessary to use afunction F (α, l_(a), f, w . . . ) which involves optical conditionssuch as the distance l_(a) between the camera and the workpiece, thefocal length f of the lens and the dimension of the image receptor w. Inthis case, Equation (d) is expressed as follows. ##EQU2##

For calculating the work angle θ from Equation (e), a mathematicalmethod may be used to obtain the function F (α, l_(a), f, w . . . ), butin such a case, variations in parameters in individual members such as alens cannot be taken into account and this results in an increasederror. Therefore, various parameters in each member should be obtainedthrough experiments. However, it is extremely difficult to carry outrigorous measurement in an optical system. Further, since the distancel_(a) between the camera and the workpiece, which is one of theparameters, varies according bending processing conditions (die size,the thickness of a sheet-like workpiece, etc.), a specialized means isrequired for measuring the distance l_(a), which brings about acomplexity in the mechanism.

Another problem lies in the process in which an image (a linearprojected light image) formed on the surface of the workpiece isphotographed by the photographing means and image processing is carriedout. In the measurement of the image at the job site, an optimumthreshold for binary conversion fluctuates due to the influence ofexternal light and the instability of the light source, so that theshape of the bright zone after the binary conversion varies whenevermeasurement is carried out. Further, unevenness in the color of thesurface of a workpiece or rolling traces inherent to steel plates oftencause irregular reflection of beams. This irregular reflection leads tosuch undesirable situations that (i) the bright zone does not assume theshape of a straight line, (ii) the edge becomes rugged, or (iii) holes Bare formed in the bright zone A as shown in FIG. 29, and in thesesituations, it is difficult to obtain a satisfactorily thin linearimage. As a result, the image C which has been thinned by imageprocessing has wavy portions or whisker-like portions (short lines) Dwhich are the cause of errors in extracting a main straight line asshown in FIG. 30.

Still another problem arises when a workpiece which has a bent portionis bent. In practical bending processing in which a workpiece is bentwith upper and lower dies, a workpiece to be photographed is not alwaysin the form of a flat sheet. When the bending processing is applied to aworkpiece having a bent portion, there is a likelihood that the bentportion and/or a part of the lower die are also photographed by thecamera. If binary conversion and image thinning process are performed onsuch an image, an error will be caused in the position of the center ofgravity and the inclination of the image.

In spite of the fact that detection of a bending angle of a workpiece bythe use of a bending angle detector is difficult or impossible in somecases, for example, where a workpiece of a particular shape is used or afinished article of a particular shape is required, conventional NCdevices are not designed to deal with such data concerning the bendingangle detector as control data. Therefore, in a bending machine equippedwith such a bending angle detector, control operation is difficult to becarried out by means of an NC device.

SUMMARY OF THE INVENTION

The present invention has been made with the above-described problems inview and therefore one of the objects of the invention is to provide abending angle detector capable of accurately detecting a bending angleof a workpiece, without involving complicated calculations and causing acomplexity in the mechanism.

Another object of the invention is to provide a straight line extractingdevice for use with the above bending angle detector, the straight lineextracting device being capable of extracting a main straight line froma linear image with high accuracy.

Still another object of the invention is to provide a straight lineextracting device for use with the above bending angle detector, thestraight line extracting device being capable of extracting only arequired straight line from an image even if the image includes otherimages than the image of a workpiece.

A further object of the invention is to provide a bending angledetecting position setting device capable of smoothly setting a bendingangle detecting position when a bending angle of a workpiece is detectedby the bending angle detector.

In accomplishing these and other objects, there has been provided, inaccordance with the present invention, a bending angle detector whereina bending angle of a workpiece is detected by image processing,comprising:

(a) projecting means for projecting light onto the workpiece at aspecified projecting angle to form a linear projected light image on thesurface of the workpiece;

(b) photographing means for photographing the surface of the workpieceon which the linear projected light image has been formed by theprojecting means;

(c) projected light image detecting means for detecting the inclinationangle and position of the linear projected light image in an imageproduced by the photographing means;

(d) memory means for storing data on the actual inclination angle of aspecimen in correspondence with the inclination angle and position ofthe specimen in an image produced by the photographing means, the actualinclination angle being preliminarily given; and

(e) calculating means for obtaining, by arithmetic operation, thebending angle of the workpiece by accessing the data stored in thememory means; using the inclination angle and position of the linearprojected light image detected by the projected light image detectingmeans.

According to the above described bending angle detector, the projectingmeans projects a linear projected light image at a specified angle ontothe surface of a workpiece which is to be bent at a desired angle; thislinear projected light image is photographed by the photographing means;and the inclination angle and position of the linear projected lightimage in the image produced by the photographing means are detected. Onthe other hand, a specimen having a given inclination angle isphotographed by the photographing means and the memory means stores dataon the actual inclination angle of the specimen in conjunction with thecorresponding inclination angle and position in an image produced by thephotographing means. By accessing the stored data with the inclinationangle and position of the linear projected light image detected by theprojected light image detecting means, the calculating means calculatesthe bending angle of the workpiece. With such an arrangement, a bendingangle of a workpiece can be accurately calculated without involvingcomplicated arithmetic operation, and based on the result of thecalculation, the upper and lower dies of the bending machine arecontrolled, thereby achieving high-accuracy bending processing.

The data stored in the memory means may be a correction value for theactual inclination angle of the specimen, the correction value beingarranged in correspondence with the inclination angle and position ofthe specimen in the image produced by photographing, or may be theactual inclination angle of the specimen itself arranged in the samemanner as described above.

The calculating means preferably calculates the bending angle of theworkpiece by interpolating the data stored in the memory means. Thisenables it to obtain the bending angle of the workpiece with highaccuracy.

The projecting means and the photographing means may be disposed at atleast one side of the bending line of the workpiece. The provision of aset of these means at both sides of the bending line increases thedetection accuracy of the bending angle detector.

The projecting means may form a linear projected light image on thesurface of a workpiece by projecting a slit light or a plurality ofaligned spot lights.

According to the invention, there is provided a straight line extractingdevice for use with a bending angle detector, which extracts a mainstraight line from a bright zone of a gray-scale image, comprising:

(a) brightness detecting means for detecting the brightness of each ofpixels which constitute the gray-scale image;

(b) main pixel calculating means for (i) performing arithmetic operationon a specified scanning axis in an image coordinate system, to obtain amain pixel associated with the optical axis of the bright zone from thedistribution of the brightness of the pixels aligned on the scanningaxis detected by the brightness detecting means and (ii) repeatedlyperforming the arithmetic operation on other scanning axes which arearranged at specified intervals, whereby a plurality of main pixels areobtained; and

(c) main straight line calculating means for obtaining the main straightline of the bright zone from a plurality of main pixels obtained by themain pixel calculating means.

According to the above straight line extracting device, the brightnessof each of the pixels constituting a gray-scale image is detected by thebrightness detecting means and a main pixel associated with the opticalaxis of the bright zone of the gray-scale image is obtained from thedistribution of the brightness of the pixels, by performing anarithmetic operation on a specified scanning axis in an image coordinatesystem. This arithmetic operation is repeatedly performed on otherscanning axes which are arranged at predetermined intervals, so that aplurality of main pixels can be obtained. From a plurality of mainpixels thus obtained, the main straight line of the bright zone can becalculated. Accordingly, the gray-scale image is processed withoutcarrying out binary conversion, so that a main straight line can beaccurately extracted without being affected by the fluctuation of anoptimum threshold etc.

The straight line component extracting means may include noiseeliminating means which eliminates noise from the gray-scale image priorto the detection of the brightness of each pixel by the brightnessdetecting means. The provision of the noise eliminating means increasesaccuracy in the extraction of the main straight line.

The noise eliminating means may eliminate noise in one of the followingways: (i) noise is eliminated by subtracting the brightness of pixelsbefore gray-scale image formation from the brightness of pixels aftergray-scale image formation; (ii) noise is eliminated by makingbrightness values, which are below a specified threshold, zero; and(iii) noise is eliminated by making the brightness values of isolatedpixels zero, these isolated pixels having adjacent pixels whosebrightness values are zero.

The main pixel calculating means obtains a main pixel in one of thefollowing methods: (i) a pixel having the highest brightness from pixelsaligned on a specified scanning axis is set as the main pixel; (ii) thebarycenter in the brightness distribution of pixels on a specifiedscanning axis is obtained and set as the main pixel; and (iii) from thedistribution of the brightness of pixels on a specified scanning axis,the half-width of each brightness is obtained and the central value ofthe obtained half-width values is set as the main pixel.

The main straight line calculating means may calculate a main straightline by obtaining an approximate straight line from a plurality of mainpixels, using the least square method. More specifically, thecalculation is performed in such a way that a specified width is allowedto an approximate straight line, thereby determining a specifiedstraight line region; then, the remotest pixel from the straight lineregion is eliminated; and the calculation for obtaining an approximatestraight line is repeatedly performed based on the remaining pixelsuntil all the pixels are included in a straight line region.

According to the invention, there is provided another straight lineextracting device for use with a bending angle detector, comprising:

(a) projecting means for projecting, at a specified projecting angle,light onto a workpiece and onto a part of a lower bender on which theworkpiece is placed, such that a linear projected light image is formedon the surfaces of the workpiece and the lower bender;

(b) photographing means for photographing the surfaces of the workpieceand the lower bender on which the linear projected light image has beenformed by the projecting means;

(c) point sequence forming means for performing binary conversion andimage thinning process on an image produced by the photographing means,thereby forming a sequence of points which is representative of theimage and whose unit is a pixel;

(d) straight line component extracting means for extracting a straightline component associated with the image of the workpiece from thesequence of points obtained by the point sequence forming means, saidstraight line component being linked to a straight line componentassociated with the image of the lower bender; and

(e) projected light image detecting means for detecting the inclinationangle and position of the linear projected light image of the workpiecein the image produced by the photographing means, based on the straightline component extracted by the straight line component extractingmeans.

According to the above straight line extracting device, the projectingmeans projects, at a specified angle, light onto the surfaces of theworkpiece and the lower die to form a linear projected light imagethereon, and this linear projected light image is photographed by thephotographing means. Then, the photographed image is converted intobinary form and thinned by the point sequence forming means, whereby theimage is expressed as a sequence of points, whose unit is a pixel.Extracted from the sequence of points thus obtained is a straight linecomponent which is associated with the image of the workpiece and whichis linked to a straight line component associated with the image of thelower bender. Based on the straight line component thus extracted, theinclination angle and position of the linear projected light image ofthe workpiece in the image photographed are detected. With such anarrangement, even if a workpiece which has been already bent is furtherbent or even if an image of other parts than a workpiece is included inthe photographed image, a required straight line alone can be extracted.This leads to an increased accuracy in the measurement of a bendingangle during bending processing and a higher processing speed.

Preferably, the point sequence forming means eliminates points atpredetermined intervals and expresses the image by a set of remainingpoints.

Preferably, the straight line component extracting means identifies astraight line lying at the bottom end of the image plane of thephotographing means as the straight line component associated with theimage of the lower bender. In this case, a straight line connecting afirst point existing at the bottom end of the image plane and a secondpoint which is adjacent to the first point is firstly obtained, and aspecified width is allowed to this straight line, thereby determining astraight line region. If a third point adjacent to the second point lieswithin the straight line region, the arithmetic operation is againperformed for obtaining a straight line including the third point. Thearithmetic operation is repeated in this way until a point which is outof a straight line region appears, and when such a point appears, a linesegment between the first point and the point just before the pointwhich is out of a straight line region is determined as the straightline component associated with the image of the workpiece and thisstraight line component is extracted. In the case where the line segmentincludes only two points aligned, this segment may be eliminated as anunnecessary part.

Preferably, the projecting means and the photographing means aredisposed at at least one side of the bending line of the workpiece, andthe provision of a set of these means at both sides of the bending lineincreases detection accuracy.

The projecting means may form a linear projected light image on thesurfaces of the workpiece and the lower bender by projecting a slitlight or a plurality of aligned spot lights.

According to the invention, there is provided a bending angle detectingposition setting device which sets a detecting position when a bendingangle of a workpiece is detected by bending angle detecting means,comprising:

(a) simulation data calculating means for obtaining, by arithmeticoperation, simulation data associated with the bending state of theworkpiece in each bending step from bending processing conditions forthe workpiece; and

(b) potential bending step calculating means for obtaining, byarithmetic operation, a potential bending step in which the bendingangle detection of the workpiece might be performed by the bending angledetecting means, from the simulation data obtained by the simulationdata calculating means.

According to the above bending angle detecting position setting device,simulation data associated with the bending state of a workpiece in eachbending step can be calculated from bending processing conditions forthe workpiece by means of the simulation data calculating means. Basedon the simulation data, the potential bending step calculating meansobtains a potential bending step in which the bending angle detection ofthe workpiece might be performed by the bending angle detecting means.This arrangement makes it possible to smoothly set a detecting positionwhere a bending angle of a workpiece is detected and therefore leads tohigh-accuracy bending processing.

In this case, there may be provided detection pattern memory means whichinstructs a detecting position where detection can be performed by thebending angle detecting means to the potential bending step obtained bythe potential bending step calculating means and which stores theinstructed detecting position as a detection pattern for each bendingstep. This increases speed in instruction when a workpiece is repeatedlyprocessed or a similar workpiece is processed, and as a result, the timerequired for setting a detecting position can be saved.

Preferably, the simulation data is comprised of the profile of aworkpiece in each bending step and various marks created on a workpieceby pretreatment. In this case, the pretreatment marks may include holes,notches, concavities and convexities which are defined on the surface ofa workpiece.

Other objects of the present invention will become apparent from thedetailed description given hereinafter. However, it should be understoodthat the detailed description and specific examples, while indicatingpreferred embodiments of the invention, are given by way of illustrationonly, since various changes and modifications within the spirit andscope of the invention will become apparent to those skilled in the artfrom this detailed description.

BRIEF DESCRIPTION OF THE DRAWINGS

FIGS. 1 to 10 illustrate one embodiment of a bending angle detectoraccording to the invention;

FIG. 1 is a side view of an essential part of a press brake;

FIG. 2 is a block diagram of an image processing method and ram controlmethod;

FIG. 3 is a view showing the positional relationship among a lightsource, workpiece and CCD camera;

FIG. 4 is a view of one example of an image;

FIG. 5 is a front view of a calibration system;

FIG. 6 is a plan view of the calibration system;

FIG. 7 is a flow chart showing processes for making a calibration table;

FIG. 8 is a graph showing one example of the calibration table;

FIG. 9 illustrates the interpolation of a correction value for a workangle;

FIG. 10 is a flow chart showing processes for measuring a work angle;

FIGS. 11 to 18 illustrate a first embodiment of a straight lineextracting device for use with a bending angle detector, according tothe invention;

FIG. 11 is a block diagram;

FIGS. 12(a)-12(f) are diagrams illustrating processing steps;

FIG. 13 is a flow chart of the processing steps;

FIG. 14 shows one example of a main pixel calculation method;

FIG. 15 shows another example of the main pixel calculation method;

FIG. 16 shows still another example of the main pixel calculationmethod;

FIG. 17 is a flow chart showing the processing steps designed to improveaccuracy;

FIG. 18 shows the comparison between the detection accuracy of the mainstraight line extracting device of the first embodiment and that of aprior art device;

FIGS. 19 to 22 illustrate a second embodiment of the straight lineextracting device for use with a bending angle detector, according tothe invention;

FIG. 19 illustrates a system arrangement;

FIG. 20 illustrates one example of an image;

FIGS. 21(a)-21(c) illustrate processing steps;

FIGS. 22/A-22/B are flow charts showing the processing steps;

FIGS. 23 to 27 illustrates one embodiment of a bending angle detectingposition setting device according to the invention;

FIG. 23 is a block diagram;

FIGS. 24(a)-24(h) illustrate the bending state of a workpiece in eachstep of bending processing;

FIGS. 25(a)-25(b) illustrate processes for analyzing a potentialdetecting position, based on the profile of the workpiece;

FIGS. 26(a)-26(b) illustrate processes for analyzing a potentialdetecting position, based on the pretreatment marks of the workpiece;

FIG. 27 is a flow chart showing setting processes by a bending angledetector;

FIGS. 28 to 30 illustrate a prior art bending angle detector;

FIG. 28 is a view showing the relationship among a beam projectionangle, an angle at which an image is formed in an image plane and abending angle;

FIG. 29 is a view of one example of a linear projected light image; and

FIG. 30 is a view of another example of the linear projected lightimage.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

With reference to the drawings, preferred embodiments of a bending angledetector, a straight line extracting device for use with a bending angledetector, and a bending angle detecting position setting deviceaccording to the invention will be hereinafter described.

(1) Bending angle detector

FIG. 1 shows the side view of an essential part of a press brake 1according to one embodiment of the invention. In this embodiment, thepress brake 1 comprises a lower bender (die) 3 supported on a support 2and an upper bender (punch) 5 attached to the under part of a ram 4which is opposite to the lower bender 3 and disposed so as to be freelylifted or lowered above the lower bender 3. A workpiece W made of ametal sheet is inserted between the upper bender 5 and the lower bender3 and the ram 4 is lowered while the workpiece W being placed on thelower bender 3, so that the workpiece W is pinched and pressed by theupper bender 5 and the lower bender 3 and accordingly bending of theworkpiece W is performed.

Provided in front of (at the main side of) the support 2 is a bracket 6on which a measurement unit 9 is disposed. The measurement unit 9includes a slit-shaped light source 7 for projecting a linear projectedlight image onto an outer face Wa of the workpiece W and a CCD camera 8for photographing the linear projected light image formed by the lightsource 7. This measuring unit 9 may be disposed behind (at the machineside of) the support 2 instead of being disposed in front of the same,or alternatively, both sides may be provided with the measuring unit 9.

As shown in FIG. 2, an image photographed by the CCD camera 8 is sent toan operation unit 10 and then displayed on a monitor television 11 whilebeing stored as image data in a memory 12. Table data on a calibrationtable (to be described later) etc., which have been input through aninput unit 13 and stored in the memory 12, is added to the image dataand based on this data, arithmetic operation is performed in theoperation unit 10. By this arithmetic operation, an angle at which theworkpiece W is to be bent is obtained. The bending angle thus obtainedis supplied to a ram control unit 14 which controls the bottom deadcenter of the ram 4, whereby the workpiece W Is bent at the desiredangle.

When a slit light L is projected, as shown in FIG. 3, onto the outerface Wa of the workpiece W thereby forming a linear projected lightimage U thereon and this linear projected light image U is photographedby the CCD camera 8, the relationship which exists among an angle θ' ofa linear projected light image U' formed in the image plane of the CCDcamera 8, the projecting angle a of the slit light L and the bendingangle θ of the workpiece W (=work angle) is described by the followingequation. This equation is based on plane projection and the same as theabove-mentioned equation (d).

    tan θ'=tan α×tan θ                 (1)

In this equation (1), the angle of view of the lens is not taken intoaccount and, therefore, in this embodiment, the linear projected lightimage U' displayed on the screen of the monitor television 11 isspecified as a straight line by image processing and the relationshipbetween the inclination angle θ' of the straight line in the image plane(i.e., on the screen of the monitor television 11) and the work angle θis calibrated, using the positional data of the straight line as aparameter. The positional data of the straight line is given by the xcoordinate of the intersection of a straight line which is drawn on thecenter of the screen of the monitor television 11 as shown in FIG. 4 andrepresented by y=Y/2 (Y is the number of pixels in a direction parallelto the y axis) and the straight line of the linear projected light imageU' (e.g., ax+by+c=0).

A calibration method will be described below. FIGS. 5 and 6 show thefront view and plan view of a calibration system used in thisembodiment, respectively.

In the calibration system, as shown in the drawings, a rail 16 used foroptical instruments is provided on a base 15 and an optical system 19comprising a CCD camera 17 and a laser generator 18 is movably placed onthe rail 16. A calibration block 20, which serves as a specimen havingan given inclination angle, is also movably placed on the rail 16, beinga predetermined distance away from the optical system 19. The positionsof the optical system 19 and the calibration block 20 are adjustablealso in a vertical direction.

In the calibration system as described above, laser light is projectedto the calibration block 20 from the laser generator 18 while thecalibration block 20 being held at a specified angle β in a specifiedposition and a projected light image formed on the calibration block 20is photographed by the CCD camera 17. The inclination angle θ' andposition x (see FIG. 4) of the projected light image in the image planeare calculated and a correction value δ for the work angle θ iscalculated. Then, the calibration block 20 is moved in the direction z(see FIGS. 5 and 6) to take a plurality of positions, and sequentialcorrection values δ corresponding to the respective positions arecalculated in the same way. Further, while the angle of the calibrationblock 20 being successively changed, sequential correction values δcorresponding to the respective angles are calculated. Based on manydata pieces thus obtained, a calibration table is prepared.

Referring now to the flow chart of FIG. 7, the processes for preparingthe calibration table will be described. In the following description,angles to be measured, that is, calibration angles are in the range ofβ=60° to 120°.

S1 to S6: Firstly, the angle β of the calibration block 20 is set to60°. The calibration block 20 having an angle β of 60° is placed andthen moved (backwards) until the image of the laser light (beam) comesto the left end of the image plane (screen). The inclination angle θ'(which corresponds to the block angle β) and position x of the projectedlight image in the image plane are calculated by image processing and acorrection value δ corresponding to the inclination angle θ' and theposition x thus obtained is calculated from equation δ=β-tan⁻¹ (tanα×tan θ'). The inclination angle θ', the position x and the correctionvalue δ are stored in the memory 12 (see FIG. 2).

S7 to S8: The calibration block 20 is then moved forwards by 2 mm. Ifthe image of the beam does not reach the right end of the image plane bythis movement, Steps S4 to S7 are repeated at the calibration blockposition after the movement. Since the calibration block 20 is moved formeasurement within the range of about 40 mm and satisfactory measurementaccuracy can be achieved with about 20 pieces of data collected fromthis range, the moving pitch of the calibration block 20 is set to 2 mmherein.

S9 to S11: In the case where the image of the beam has reached the rightend of the image plane by the movement of the calibration block 20, ifthe block angle β of the calibration block 20 does not reach the presetmaximum angle (=120°), in other words, if the calibration block 20 isnot the last calibration block with the maximum angle, a specified angle(=3°) is added to the block angle β and then Steps S2 and onwards arerepeated with the next calibration block 20. When the measurement of thelast calibration block 20 has been completed, a calibration table isprepared either by rearranging data strings (θ', x, δ) stored, in thememory 12 or by converting the data strings into the form of equationsof approximate curved surfaces or approximate lines. It is confirmedfrom experience that a tolerance of about ±0.1° can be ensured for themeasurement, by performing calibration in which the block angle β ischanged by 3° to 5° within the range of 60° to 120°.

One example of the calibration table thus prepared is shown in FIG. 8.By the use of this calibration table, the correction value δ for thework angle θ can be obtained from the inclination angle θ' and positionx of the projected light image formed in the image plane. Thiscorrection value δ is added to the work angle θ obtained from theaforesaid equation (1), thereby obtaining the final work angle θ. Notethat the number of data pieces collected from the direction xcorresponds to the pitch of the movement of the calibration block 20 inthe direction z in FIG. 5, and that the number of data pieces collectedfrom the direction θ' corresponds to the number of angular positions βwhich the calibration block 20 takes. When data pieces obtained as thecalibration block 20 moves in the direction z and data pieces obtainedas the block angle β increases are plotted in the graph of FIG. 8, theformer is represented by the direction of arrow P and the latter by thedirection of arrow Q. Note that the number of data pieces can bedetermined in accordance with the required accuracy.

In practice, the correction value δ is calculated using a mathematicalinterpolation method, after referring to the data of the calibrationtable with the inclination angle θ and position x of the projected lightimage which have been obtained by image processing. Now, as one exampleof the interpolation method, a method in which a divided polynomial isused will be described. According to this method, an arbitrary curvedsurface representative of three variables (θ', x, δ') such as shown inFIG. 8 is approximated as shown in FIG. 9, by a linear equation of threepoints which are proximate to the curved surface. More specifically,three points (three table data pieces) (θ₁ ', x₁, δ₁), (θ₂ ', x₂, δ₂),(θ₃ ', x₃, δ₃), which enclose a data point (θ₀ ', x₀) in the θ'-x plane,are firstly extracted and then, a plane a θ'+bx+cδ+d=0 determined by thethree points is obtained. From the plane a θ'+bx+c δ+d=0, a correctionvalue δ₀ is obtained using the following equation.

    δ.sub.0 =-(a θ.sub.0 '+bx.sub.0 +d)/c

With such an interpolation method, curved surfaces can be expressed by anumber of linear polynomial equations so that interpolation can beeasily carried out. This interpolation method is only an example, and itis therefore apparent that other interpolation methods may be employed.

With reference to the flow chart of FIG. 10, the processes of work anglemeasurement which includes the calculation of the correction value δ bythe above-described interpolation method will be described.

T1 to T3: The inclination angle θ₀ ' and position x₀ of the projectedlight image in the image plane are obtained by image processing. Then,the calibration table comprised of three dimensional data strings θ'-x-δis called and three points (θ₁ ', X₁, δ₁) (θ₂ ', X₂, δ₂), (θ₃ ', X₃,δ₃), which are proximate to a point (θ₀ ', X₀) and enclose it in theθ'-x plane of the calibration table, are extracted.

T4 to T6: An equation of a plane a θ'+bx+c δ+d=0 which passes throughthe extracted three points (θ₁ ', X₁, δ₁), (θ₂ ', X₂, δ₂) (θ₃ ', X₃, δ₃)is obtained and θ'=θ₀ ', x=X₀ are substituted in the equation of theplane aθ'+bx+cδ+d=0, thereby obtaining the correction value δ₀. Then,the work angle θ is obtained from equation θ=tan⁻¹ (tan α×tan θ')+δ₀where α is the projecting angle of the beam. The work angle θ thusobtained is released to the ram control unit 14 (see FIG. 2).

In the foregoing embodiment, the correction value δ is obtained from theinclination angle θ' and position x of the linear projected light imagein the image plane, using the calibration table and the work angle θ iscalculated based on the correction value δ. Alternatively, the workangle θ may be obtained such that a data table by the use of which thework angle θ can be directly calculated from the inclination angle θ'and the position x is prepared and the work angle θ is obtained byaccessing data in such a data table.

Although the calibration table in the foregoing embodiment is composedof a group of three dimensional coordinates of points as shown in FIG.8, it may be expressed in other forms such as three dimensionalcoordinates of lines or curved surfaces. These lines and curved surfacesare obtained from the coordinates of points, using an approximationmethod (e.g., the least square method). The calibration table composedof three-dimensional coordinates of lines or curved surfaces canadvantageously save the time required for calculation, but it imposessuch a drawback that measurement accuracy decreases when uncertainfactors such as variations in the image receptor and lens distortionhave a significant effect on the measurement.

While a slit light is used to form the linear projected light image inthe foregoing embodiment, it is also possible that a plurality ofaligned spot lights are used instead of the slit light and anapproximate line passing through the center of each projected spot lightis obtained by arithmetic operation, whereby the angle of the projectedlight image is obtained.

(2) Main straight line extracting device for extracting a main straightline from a projected light image:

Now there will be explained a preferred embodiment of a main straightline extracting device for use with the above-described bending angledetector. This device extracts a main straight line from a projectedlight image by image processing, when the above bending angle detectorcalculates the inclination angle θ₀ ' and position x₀ of the projectedlight image in the image plane (see Step T1 in FIG. 10).

In this embodiment, the linear projected light image in the form of agray-scale image is taken in a main straight line extracting device 21through an image input unit 22, as shown in FIG. 11. The gray-scaleimage thus taken in has 420 (in a vertical direction)×510 (in a lateraldirection) pixels and 256 (0 to 255) gradations of brightness for eachpixel.

The main straight line extracting device 21 comprises (i) a noiseeliminating unit 23 for eliminating noise from the gray-scale imagewhich has been supplied to the device 21 through the image input unit22; (ii) a brightness detecting unit 24 for detecting the brightness ofeach pixel in the gray-scale image from which noise has been eliminatedby the noise eliminating unit 23; (iii) a main pixel calculating unit 25for obtaining, by arithmetic operation, main pixels associated with theoptical axis of a bright zone from the distribution of the brightness ofpixels detected by the brightness detecting unit 24; and (iv) a mainstraight line calculating unit 26 for obtaining, by arithmeticoperation, a main straight line from a plurality of main pixels obtainedby the main pixel calculating unit 25, using a mathematicalapproximation method such as the least square method.

According to the main straight line extracting device 21 having suchcomponents, after the gray-scale image having a linear bright zone a asshown in FIG. 12(a) has been supplied to the device 21 through the imageinput unit 22, noise is eliminated from the gray-scale image by thenoise eliminating unit 23. Thereafter, the brightness detecting unit 24detects the brightness of each of pixels aligned in one pixel line bwhich extends in a direction parallel to the x axis of the coordinatesystem (x-y) representative of the gray-scale image as shown in FIG.12(b). From the distribution of the brightness values obtained in thisway, the main pixel calculating unit 25 obtains, by arithmeticoperation, a main pixel c associated with the optical axis of the brightzone a. Such arithmetic operation for obtaining a main pixel is repeatedon other pixel lines b', b" . . . which are parallel to the pixel line b(they are not necessarily parallel to the pixel line 1)) as shown inFIG. 12(c), so that main pixels c', c" . . . can be extracted as asequence of points in the image plane and one pixel is regarded as oneunit in this sequence. From the sequence of pixels c', c" . . . thusextracted, a main straight line (approximate line) d as shown in FIG.12(d) is obtained by using a mathematical approximation method such asthe least square method.

In order to increase the extraction accuracy of the main straight line,a specified width (e.g., one pixel) is allowed to the approximate line dobtained in the above method, thereby determining a main straight lineregion e as shown in FIG. 12(e), and the remotest point (pixel) c_(e)from the main straight line region e is deleted. Thereafter, anapproximate line d' is again obtained based on the remaining main pixelsas shown in FIG. 12(f) and a main straight line region e' is set in thesame manner as described above. This process is repeatedly performeduntil all the main pixels are included in a main straight line region(i.e., until all the main pixels converge), thereby determining a finalmain straight line.

Reference is made to the flow chart of FIG. 13 for more particularlydescribing the processes of the main straight line extraction shown inFIGS. 12(a) to 12(d).

U1 to U6: The light source for projecting a linear projected light imageonto the workpiece is turned OFF and an image having 256 gradations ofbrightness is input in an image memory (M1). Then, the light source isturned ON and an image having 256 gradations of brightness is input inanother image memory (M2). Subtraction between the two images input inthe memories M1, M2 (M3=M2-M1) is executed and the light source isturned OFF again. Through the above process, an image to be processed istaken in the main straight line extracting device and noise (thebrightness of unnecessary parts) generated in the image plane iseliminated through the subtraction process performed on the imagescreated before and after projection of a beam from the light source.

U7 to U10: A number i which represents the number of points associatedwith the optical axis of the bright zone is set to 0 and the initialvalue y₀ of the scanning line y_(i) (=pixel line) is set to 0.Thereafter, the distribution (X, dX) of brightness on a scan liney=y_(i) is taken out of the image data having 256 graduations ofbrightness and stored in the image memory (M3). In this embodiment, dXrepresents a brightness (in the range of 0 to 255) at the position x=X,and X satisfies 0<X<X_(max) (X_(max) represents the number of pixelsaligned in a direction parallel to the x-axis of the image plane).

In order to obtain the barycenter in the brightness distribution, thesum (N=ΣdX) of the brightness dX is obtained and the sum (S=Σ(dX×X)) ofthe product of the coordinates X and the brightness dX corresponding tothe coordinates X is obtained. From the sums N and S thus obtained, theposition of the optical axis x_(i) on the scanning line y=y_(i) iscalculated using the equation x_(i) =N/S. FIG. 14 shows the concept ofthe process for obtaining the position of the optical axis from thebarycenter (represented by chain line) of the brightness distribution.This method using barycenter In brightness distribution is usefulparticularly when the brightness distribution obtained from such asurface is not a normal distribution because the workpiece does not haveuniform color at its surface.

U11 to U13: If y_(i) does not reach y_(max) (y_(i) =the number of pixelsaligned in a direction parallel to the y-axis of the image plane), thenumber i is incremented by one and the scanning line y_(i) is moved in adirection parallel to the y-axis by a scan spacing (pitch) p (i.e.,y_(i) =y₀ +ip). Then, Steps U8 and onwards are repeated. If y_(i) hasreached y_(max), a main straight line (approximate line) ax+by+c=0 isobtained from a plurality of points associated with the optical axis(x_(i), y_(i)), using the least square method.

In the foregoing embodiment, noise elimination is carried out bysubtracting operation performed on images before and after beamprojection, but noise could be eliminated in the following ways. (1) Aspecified threshold is set for brightness and brightness values belowthis threshold are set to zero, whereby noise elimination can beperformed. (2) The brightness values of isolated pixels are set to zero,thereby eliminating noise. The pixels adjacent to the isolated pixelhave a brightness of 0.

Although a main pixel is obtained from the barycenter in the brightnessdistribution of pixels aligned on a specified scanning axis, there areother methods for obtaining a main pixel. (1) A pixel having the highestbrightness is determined as the main pixel (see FIG. 15). (2) Thehalf-width g of the brightness of each of pixels aligned on a specifiedscanning axis is obtained from their brightness distribution and thecentral value of the half-width g is determined as the main pixel (seeFIG. 16). The method (1) is effective when the brightness distributionis a normal distribution when a workpiece has uniform color at itssurface, while the method (2) is effective when the brightnessdistribution is not a normal distribution like the method using thebarycenter in the brightness distribution.

With reference to the flow chart of FIG. 17, there will be explained acontrol flow of the main straight line extraction designed to increaseaccuracy and shown in FIGS. 12(e) and 12(f).

V1 to V2: The main straight line region "width" (e.g., width=1 pixel) isinput. Then, the main straight line (approximate line) ax+by+c=0 isobtained from k-points (x_(i), y_(i)) (0≦i≦k) which designate theposition of the optical axis in the image plane, using the least squaremethod.

V3 to V6: The number i which represents the number of points associatedwith the optical axis is set to zero. Then, the distance L_(i) betweenthe point (x_(i), y_(i)) and the straight line ax+by+c=0 is calculated.If the number i does not reach k, the number i is incremented by one andthe distance L_(i) is successively calculated.

V7 to V11: If the number i has reached k, a point (x_(j), y_(j))associated with the optical axis, which is the remotest point from theapproximate line, is found and the distance L_(j) between the remotestpoint (x_(j), y_(j)) and the approximate line is obtained. If thedistance L_(j) does not fall within the main straight line region"width", data on the point (x_(i), y_(j)) is deleted and k isdecremented by one, for the purpose of removing the point which is outof the main straight line region "width". Then, the program returns toStep V2. Steps V2 onward are repeated and when all the points (x_(j),y_(j)) are included in the main straight line region "width", the mainstraight line (ax+by+c=0) is determined.

When comparison was made between the main straight line extracted by themain straight line extracting device 21 of this embodiment and a mainstraight line extracted by binary conversion in terms of angle in theimage plane, the result was as shown in FIG. 18. It Is understood fromFIG. 18 that the variation in the bending angle detected in theembodiment is smaller than that detected in the binary conversionprocess and therefore the device according to the embodiment can improvedetection accuracy over the prior art.

(3) Straight line extracting device for extracting only a necessarystraight line in an image plane

There will be given an explanation on another preferred embodiment ofthe straight line extracting device of the invention, in which if aworkpiece bent at a plurality of positions is processed, only anecessary straight line in the image plane can be extracted when thebending angle detector detects the inclination angle θ₀ ' and positionx₀ of a projected light image in the image plane (see Step T1 in FIG.10).

As shown in FIG. 19, in the bending angle detector according to thisembodiment, the light source 7 is disposed such that a slit light fromthe light source 7 is projected onto the outer face Wa of the workpieceW and a part of the lower bender 3 and the CCD camera 8 is so disposedas to take the image of the lower bender 3 in the corner of the field ofview. FIG. 20 shows a photographed image of the workpiece W and thelower bender 3 of FIG. 19. In FIG. 20, l represents the image of thelower bender 3 and n represents the image of a bent portion at theforward end of the workpiece W. The image portions 1 and n are notnecessary for the bending angle detection of the workpiece W. Thisembodiment provides a method for extracting only a straight line (=theportion m in the case of FIG. 20) necessary for bending angle detectionfrom an image taken in the straight line extracting device.

In the straight line extracting device according to the embodiment, anecessary straight line is extracted in the following way. An imagephotographed by the CCD camera 8 is converted into binary form with anappropriated threshold, using a known image processing technique andthinned to form a line having a width equal to one pixel. The thinnedline having a width equal to one pixel is represented as an aggregate(sequence) of points (x, y) whose unit is one pixel. In the imagecomposed of a sequence of points, a line s is drawn between a point qlocated at the bottom end of the image and a point r that is adjacent tothe point q as shown in FIG. 21(a). A preset width t (e.g., t=one pixel)is allowed to the line s (see FIG. 21(b)) and it is determined whether apoint u next to the point r is within the width t. If so, a line vincluding the point u is drawn and specified as one line segment.Otherwise, the line extending to the point r is specified as one linesegment. Such a process is repeated, thereby extracting a graphicpattern consisting of several straight lines (see FIG. 21(c)) and a linew linked to the line v which crosses the bottom end of the image istaken out of the pattern, whereby a target straight line can beextracted. In the above process of determining a line segment, if a linesegment consisting of only two points is obtained, this line segment ispreferably deleted as an unnecessary segment.

Referring to the flow chart of FIG. 22, the straight line extractingprocesses depicted in FIGS. 21(a) to 21(c) will be described.

W1 to W3: Image processing is performed on the image of a beam which hasbeen taken in the straight line extracting device. This image isexpressed as an aggregate of points whose unit is one pixel. Morespecifically, the image is expressed by n sets of coordinates (x_(i),y_(i)) (0≦i≦n), each set representing a point. In order to start withthe lowest point in the image, i is set to n-1 and then the linearequation ax+by+c=0, which passes through the starting point (x_(i),y_(i)) and a point (x_(i-1), y_(i-1)) next to the starting point, iscalculated using the least square method.

W4 to W8: Number k is set to 2, and the distance l_(k) between a point(x_(i-k), y_(i-k)) and the linear equation ax+by+c=0 is calculated. Thepoint (x_(i-k), y_(i-k)) is next to the point (x_(i-1), y_(i-1)) andfurther from the bottom end of the image than the point (x_(i-1),y_(i-1)). If the calculated distance l_(k) falls within a preset width W(W=2 pixels is preferable), the linear equation ax+by+c=0 regarding(k+1) points (i.e., all the points from the point (x_(i), y_(i)) to thepoint (x_(i-k), y_(i-k))) is calculated using the least square method.Then, the number k is incremented by 1 and the program returns to StepW5.

W9 to W10: If the distance l_(k) from the point (x_(i-k), y_(i-k)) tothe linear equation ax+by+c=0 exceeds the width W, it is determined thatk-points (i.e., all the points from the point (x_(i), y_(i)) to thepoint (x_(i-k+1), y_(i-k+1))) are included in the straight lineax+by+c=0, and a line L given by the point (x_(i), y_(i)) through thepoint (x_(i-k+1), y_(i-k+1)) is calculated from the following equation.

    L=((x.sub.i-k+1 -x.sub.i).sup.2 +(y.sub.i-k+1 -y.sub.i).sup.2).sup.1/2

W11 to W15: If the length L thus obtained does not exceeds a specifiedvalue H, either of the following processes will be executed. Thespecified value H is set for the determination on the length of astraight line and is preferably equal to half of the length of the image(=more than 250 pixels).

(i) When i-k+1>0 (i.e., if there exist more points to be extracted), iis set to i-k (i=i-k) in order to start with the next point and then theprogram returns to Step W3.

(ii) When i-k+1≦0 (i.e., if there is no point to be extracted), it isdetermined that an error has occurred and then the flow is terminated.

On the other hand, if the length L exceeds the specified value H, it isdetermined that the obtained linear equation ax+by+c=0 is a point to beextracted on the workpiece, and based on this line, the inclinationangle θ' and position x are calculated, using the following equationsrespectively. Thereafter, the flow is terminated.

    θ'=tan.sup.-1 (a/b)

    x=-(b×Y/2+c)/a

where Y is the number of pixels aligned in a direction parallel to they-axis of the image.

In the straight line extracting device according to the foregoingembodiment, when a thinned line having a width equal to one pixel isexpressed as an aggregate of points, points may be deleted at specifiedintervals depending on accuracy required so that the time required forcalculation can be saved.

(4) Bending angle detecting position setting device

There will be explained a preferred embodiment of a bending angledetecting position setting device for setting a bending angle detectingposition when a bending angle of the workpiece W is detected by the useof the above-described bending angle detector.

FIG. 23 shows the system arrangement of this embodiment in which asimulation data operation unit 27 is provided for performing arithmeticoperation to obtain simulation data from machine conditions andprocessing conditions such as the shapes of a workpiece and dies. Thesimulation data is associated with the bending state of the workpiece Win each bending step (simulation data for each bending step is shown inFIG. 24, taking a sash for example). The data from the simulation dataoperation unit 27 is supplied to a bending angle detecting positionsetting device 28. The machine conditions mentioned herein are definedas the specification of a bending machine (the shapes of a table andram) and the specification of a bending angle detector (the number ofunits, the number of traveling axes, traveling distance, the region ofeffective detection). The workpiece shape includes bending angle,bending length, the lengths of legs, material, and the shapes ofnotches, concavities and convexities when the workpiece is blank. Theshapes of dies includes V-width, die shape, punch shape, the shape of adie holder etc.

In the bending angle detecting position setting device 28, a potentialdetecting position analyzing unit 29 analyzes a position where thebending angle detection of the workpiece W might be performed (thisposition is hereinafter referred to as "potential detecting position"),upon receipt of the data from the simulation data operation unit 27. Theanalyses are separately carried out based on the profile of theworkpiece W and based on pretreatment marks (piercing, embossing etc.).A detecting position instructing unit 30 releases, according to theresults of the analyses, concrete information on a detecting positionsuch as the position of the bending angle detector in a longitudinaldirection and in a vertical direction. In order to realize the detectionbased on the instruction from the detecting position instructing unit30, a detecting position setting unit 31 performs arithmetic operationto obtain data for controlling the bending angle detector. According tothe control data obtained by the detecting position setting unit 31, adetecting position control unit 32 controls the bending positiondetector. Detection patterns for the bending angle detector instructedby the detecting position instructing unit 30 are stored and updated ina memory 33, so that the time required for instruction can be saved whenthe same workpiece is repeatedly processed or a similar workpiece isprocessed. The detecting position setting unit 31 can set a position fora bending angle detector in cases where a plurality of bending angledetectors are used or where progressive forming is carried out. Thedetecting position control unit 32 controls the unitized bending angledetector comprising a light source and CCD camera such that the detectormoves in a longitudinal direction of the bending machine and such thatthe light projecting angle of the light source and the light receivingangle of the CCD camera are altered.

The potential detecting position analyses performed by the potentialdetecting position analyzing unit 29 are as follows.

(A) Potential detecting position analysis based on the profile of theworkpiece W (see FIG. 25):

In order to detect the bending angle of the workpiece W correctly, it isnecessary to determine whether the slit light L from the light source isprojected onto the same plane as that of the workpiece W by a specifiedwidth. This determination is carried out in the following procedure.FIGS. 25(a) and 25(b) show the determination procedure and FIG. 25(b) isa partially enlarged view of FIG. 25(a).

(1) Line segments GI, JK, G'I', J'K' which are offset by a minutedistance ε from the workpiece W and line segments EK and E'K' which areouter lines of the slit light L are defined. Then, it is checked whetherany of these line segments GI, JK, G'I', J'K', EK, E'K' intersects anyof the sides 0-1, 1-2, 2-3, 3-4, 4-5 of the workpiece W.

(2) It is checked if the end point 0 or 5 of the workpiece W lies withinthe area enclosed by the points G, I, J, K or G', I', J', K'.

If there is no intersection of the workpiece W and the line segments andthe ends of the workpiece W do not lie within either area, it isdetermined that bending angle detection is possible.

(B) Potential detecting position analysis based on marks created on theworkpiece W by pretreatment (see FIG. 26):

If there is a hole, notch, convexity, concavity or the like on the spotwhere the slit light L is projected onto the workpiece W, bending angledetection cannot be performed smoothly, therefore it is necessary todetermine whether such marks exist. The determination on the existenceof marks is carried out in the following procedure. FIGS. 26(a) and26(b) illustrate the processes of the determination and FIG. 26(b) showsthe workpiece W in an unfolded condition.

(1) The workpiece W is unfolded. Then, the region where the slit light Limpinges is obtained from the workpiece in an unfolded condition, takinginto account stretched portions of the bent corner and the projectingposition of the slit light L.

(2) Pretreatment marks are divided into individual units such as hole A,hole B, hole C and so on.

(3) For each pretreatment mark, a maximum value Y_(nmax) and minimumvalue Y_(nmin) in the Y-axis are obtained. Then, the positionalrelationship between the maximum value Y_(nmax), the minimum valueY_(nmin) and lines Ya, Yb which define the region on which the slitlight L is projected is checked, thereby determining whether the markaffects the bending angle detection.

(i) If Y_(nmax), Y_(nmin) >Ya or Y_(nmax), Y_(nmin) <Yb, it isdetermined that the mark does not affect the detection. On the otherhand, if these conditions are not satisfied, it is determined that themark affects the detection.

(ii) A region where detection cannot be carried out is determined, basedon the shape (circle, square etc.) and position of each unit whichaffects the detection and the positional relationship between each unitand the lines Ya, Yb.

Reference is made to the flow chart of FIG. 27, for describing theprocesses of setting a detecting position for the bending angle detectorby means of the bending angle detecting position setting device 28according to the embodiment.

X1 to X3: Machine conditions, the shapes of the workpiece W and dies areinput.

X4 to X5: A bending order for the workpiece W is analyzed, therebyobtaining simulation data associated with the bending state of theworkpiece W in each bending step. Upon receipt of the simulation data,the potential detecting position analyzing unit 29 performs thepotential detecting position analyses based on the profile of theworkpiece W and based on pretreatment marks. The results of the analysesare displayed. Note that a plurality of results are output in thebending order analysis.

X6 to X9: Determination as to whether the results of the analyses aregood or not is performed and if they are not good, the program returnsto Step X4 to do analyses again. On the other hand, if the results areall good, the detecting position instructing unit 30 instructs,according to the result of the analyses, concrete information on adetecting position for the bending angle detector in terms of alongitudinal direction and vertical direction. In accordance with theinstruction, control data for the bending angle detector is created. Inthis case, preliminarily registered detection patterns (e.g., a patternindicating an eccentric position from the center of the workpiece W) areutilized and new detection patterns (updated data) are registered.

If setting processes in all the steps are not completed, the process ischanged and the instructing/setting process in Step X7 is againexecuted. If completed, the flow is terminated.

In Step X4 of the flow chart of FIG. 27, the bending order analysis ispreferably performed taking into consideration not only the potentialdetecting position analyses but also how to facilitate image processingin the bending angle detector.

In the forgoing embodiment of the bending angle detecting-positionsetting device 28, the bending angle detector is preferably retractedafter bending angle detection so as not to disturb the processing.

It is preferable that when the bending angle detector is moved to aspecified position, the detected data calibration is automaticallyperformed as the detector moves, by the use of, for example, thecalibration table.

In the bending angle detecting position setting device 28 of theforegoing embodiment, a potential position for bending angle detectionis first obtained and based on this potential position, a detectingposition is instructed. Alternatively, a detecting position may bedetermined in the following way: a detecting position is firstlyappointed and a determination as to whether detection can be performedin the appointed detecting position is automatically performed, wherebya detecting position is obtained.

The invention being thus described, it will be obvious that the same maybe varied in many ways. Such variations are not to be regarded as adeparture from the spirit and scope of the invention, and all suchmodifications as would be obvious to one skilled in the art are intendedto be included within the scope of the following claims.

INDUSTRIAL APPLICABILITY

According to the bending angle detector of the invention, a bendingangle of a workpiece can be detected with high accuracy by a simplemechanism, while calibrating uncertain factors such as lens distortionand variations in the image receptor. This bending angle detection doesnot involve measurement of the distance between a workpiece and thephotographing means, measurement of the beam projecting angle of theprojecting means, nor complicated arithmetic operation.

According to the first straight line extracting device for use with abending angle detector, main pixels in the bright zone of a gray-scaleimage are obtained without carrying out binary conversion and from themain pixels, a main straight line is extracted, so that the accuracy ofthe straight line extraction can be markedly improved.

According to the second straight line extracting device for use with abending angle detector, the photographing means is so disposed that thelower bender is photographed and a straight line component linked to theimage of the lower bender is extracted, so that even if a workpiecewhich has been already bent is bent again or even if images other thanthe image of a workpiece are included in a photographed image, only astraight line required for bending angle detection can be extracted.This markedly increases the accuracy of the bending angle detection.Further, there is no need to obtain other data, so long as a straightline at the bottom end of the image and a straight line linked to theline at the bottom end are obtained. This contributes to saving of thetime required for calculation.

With the bending angle detecting position setting device of theinvention, a potential position for bending angle detection can besmoothly set, so that high-accuracy bending processing can be achieved.

We claim:
 1. A bending angle detector wherein a bending angle of asheet-like workpiece, which is bent into a desired angle, is detected byimage processing, comprising:(a) projecting means for projecting lightonto the workpiece at a specified projecting angle to form a linearprojected light image on a surface of the workpiece; (b) photographingmeans for photographing the surface of the workpiece on which saidlinear projected light image has been formed by said projecting means;(c) projected light image detecting means for detecting an inclinationangle and a position of said linear projected light image in an imageproduced by said photographing means; (d) memory means for storing 1)first data on an actual inclination angle of a specimen incorrespondence with 2) second data on an inclination angle and aposition of an image of the specimen produced by said photographingmeans when said projecting means projected light onto the specimen atsaid specified projecting angle, the actual inclination angle beingpreliminarily given; and (e) calculating means for obtaining, byarithmetic operation, the bending angle of the workpiece by accessingsaid first and second data stored in the memory means, using theinclination angle and the position of said linear projected light imagedetected by said projected light image detecting means.
 2. The bendingangle detector as set forth in claim 1, wherein said second dataincludes a correction value based upon the inclination angle andposition of the specimen image.
 3. The bending angle detector as setforth in claim 1, wherein said calculating means calculates the bendingangle of the workpiece by interpolating the data stored in the memorymeans.
 4. The bending angle detector as set forth in claim 1, 2, or 3,wherein said projecting means and said photographing means are disposedat least on one side of a bending line of the workpiece.
 5. The bendingangle detector as set forth in claim 4, wherein said projecting meansprojects a slit light or a plurality of aligned spot lights, thereinforming the linear projected light image on the surface of theworkpiece.
 6. A straight line extracting device for use with a bendingangle detector in a bending machine for bending a sheet-like workpieceinto a desired angle by pinching and pressing the workpiece placed on alower bender with an upper bender, said straight line extracting devicecomprising:(a) projecting means for projecting, at a specifiedprojecting angle, light onto the workpiece and onto a part of the lowerbender on which the workpiece is placed, such that a linear projectedlight image is formed on surfaces of the workpiece and the lower bender;(b) photographing means for photographing the surfaces of the workpieceand the lower bender on which said linear projected light image has beenformed by said projecting means; (c) point sequence forming means forperforming binary conversion and image thinning process on an imageproduced by said photographing means, therein forming a sequence ofpoints which is representative of the image having a unit which is apixel; (d) straight line component extracting means for extracting astraight line component associated with the image of the workpiece fromsaid sequence of points obtained by said point sequence forming means,said straight line component being linked to a straight line componentassociated with the image of the lower bender; and (e) projected lightimage detecting means for detecting inclination angle and position ofsaid linear projected light image of the workpiece in the image producedby said photographing means, based on said straight line componentextracted by said straight line component extracting means.
 7. Thestraight line extracting device for use with a bending angle detector asset forth in claim 6, wherein said point sequence forming means deletespoints at specified intervals and forms said sequence of pointsrepresentative of the image based on remaining points.
 8. The straightline extracting device for use with a bending angle detector as setforth in claim 6, wherein said straight line component extracting meansdetermines that a straight line crossing a bottom end of the imageproduced by said photographing means is said straight line componentassociated with the image of the lower bender.
 9. The straight lineextracting device for use with a bending angle detector as set forth inclaim 6 or 7, wherein said projecting means and said photographing meansare disposed at least on one side of a bending line of the workpiece.10. The straight line extracting device for use with a bending angledetector as set forth in claim 9, wherein said projecting means projectsa slit light or a plurality of aligned spot lights, therein forming saidlinear projected light image on the surfaces of the workpiece and thelower bender.
 11. A bending angle detector wherein a bending angle of asheet-like workpiece, which is bent into a desired angle, is detected byimage processing, comprising:projecting means for projecting light ontothe workpiece at a specified projecting angle to form a linear projectedlight image on a surface of the workpiece; photographing means forphotographing the surface of the workpiece on which said linearprojected light image has been formed by said projecting means; displaymeans for displaying an image produced by said photographing means;projected light image detecting means for detecting an inclination angleand a position of said linear projected light image on said image onsaid display means; memory means for storing 1) first data on an actualinclination angle of a specimen in correspondence with 2) second data onan inclination angle and a position of an image of the specimen producedby said photographing means when said projecting means projected lightonto the specimen at said specified projecting angle, the actualinclination angle being preliminarily given; and calculating means forobtaining, by arithmetic operation, the bending angle of the workpieceby accessing said first and second data stored in the memory means,using the inclination angle and the position of said linear projectedlight image detected by said projected light image detecting means. 12.A straight line extracting device for use with a bending angle detectorin a bending machine for bending a sheet-like workpiece into a desiredangle by pinching and pressing the workpiece placed on a lower benderwith an upper bender, said straight line extracting devicecomprising:projecting means for projecting, at a specified projectingangle, light onto the workpiece and onto a part of the lower bender onwhich the workpiece is placed, such that a linear projected light imageis formed on surfaces of the workpiece and the lower bender;photographing means for photographing the surfaces of the workpiece andthe lower bender on which said linear projected light image has beenformed by said projecting means; display means for displaying an imageproduced by said photographing means; point sequence forming means forperforming binary conversion and image thinning process on said image onsaid display means, therein forming a sequence of points which isrepresentative of the image having a unit which is a pixel; straightline component extracting means for extracting a straight line componentassociated with the image of the workpiece from said sequence of pointsobtained by said point sequence forming means, said straight linecomponent being linked to a straight line component associated with theimage of the lower bender; and projected light image detecting means fordetecting inclination angle and position of said linear projected lightimage of the workpiece on the image on said display means, based on saidstraight line component extracted by said straight line componentextracting means.